<template>
  <div class="common-layout">
    <el-container>
      <el-aside width="200px">
        <div class="title">通用后台管理系统</div>
        <el-menu
          active-text-color="#ffd04b"
          background-color="#545c64"
          class="el-menu-vertical-demo"
          default-active="2"
          text-color="#fff"
          router
          @open="handleOpen"
          @close="handleClose"
        >
          <el-menu-item index="componentsProp">
            <el-icon>
              <icon-menu />
            </el-icon>
            <span>组件之间通信</span>
          </el-menu-item>
          <el-sub-menu index="1">
            <template #title>
              <el-icon>
                <location />
              </el-icon>
              <span>进阶函数</span>
            </template>
            <el-menu-item-group title="渲染函数">
              <el-menu-item index="render_h">h函数</el-menu-item>
              <el-menu-item index="1-2">item two</el-menu-item>
            </el-menu-item-group>
            <el-menu-item-group title="服务端渲染">
              <el-menu-item index="server_renderToString">renderToString</el-menu-item>
            </el-menu-item-group>
            <el-sub-menu index="1-4">
              <template #title>item four</template>
              <el-menu-item index="1-4-1">item one</el-menu-item>
            </el-sub-menu>
          </el-sub-menu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header>Header</el-header>
        <el-main>
          <el-card>
            <router-view></router-view>
          </el-card>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
  
  <script lang="ts" setup>
import {
  Document,
  Menu as IconMenu,
  Location,
  Setting
} from "@element-plus/icons-vue";
const handleOpen = (key: string, keyPath: string[]) => {
  console.log(key, keyPath);
};
const handleClose = (key: string, keyPath: string[]) => {
  console.log(key, keyPath);
};
</script>
<style lang="scss" scoped>
//  /deep/
// ::v-deep
// :deep(.el-sub-menu__title) {
//   color: #d32222;
// }
</style>
<style lang="scss" scoped>
// 侧边栏
.el-aside {
  height: 100vh;
  background: #2b303b;
  width: 210px;
  // 隐藏滚动条
  overflow-x: hidden;

  // 菜单
  .el-menu {
    background: #2b303b;
    width: 210px;
    height: 90vh;
    border-right: 0px;
  }

  // 标题
  .title {
    padding: 20px;
    display: flex;
    justify-content: center;
    color: #fff;
    background: #2b303b;
  }

  .el-menu-item {
    color: #fff;
  }

  // .el-sub-menu__title {
  // 	color: #fff;
  // }
}

.el-header {
  display: flex;
  height: 55px;
  background: #262f3e;
  color: #c1c6c8;
  align-items: center;
  justify-content: space-between;

  // 欢迎语
  .header-left-content {
    font-size: 14px;
  }

  .header-right-content {
    width: 160px;
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
}

// 徽章
.item {
  cursor: pointer;
}

.el-main {
  --el-main-padding: 0;
  background-color: #f3f4fa;
  padding: 15px;
}

// 无子菜单的
.el-menu-item:hover {
  background: #006eff;
}

// 有子菜单的
:deep(.el-sub-menu__title:hover) {
  background: #006eff;
}

:deep(.el-sub-menu__title) {
  color: #fff;
}

:deep(.el-menu--inline) {
  background: #2b303b;
}
</style>
  